package com.wondersgroup.fjzlpt.org.dao.impl.jtqy;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.repository.sql.bean.SQLBean;
import com.quick.framework.boot.repository.sql.bean.table.TableBean;
import com.quick.framework.boot.repository.sql.jdbcTemplate.impl.BaseJTDAOImpl;
import com.wondersgroup.fjzlpt.org.dao.inter.jtqy.JmxxDAO;
@Repository
public class JmxxDAOImpl extends BaseJTDAOImpl implements JmxxDAO {

	@Override
	@Autowired
	@Qualifier("TB_JTQY_JMXX")
	public void setTb(TableBean tb) {
		super.setTb(tb);
	}
	
	@Override
	public JSONObject queryOne(Map<String, String> map) {
		StringBuilder sql = new StringBuilder("select a.* from TB_JTQY_JMXX a where 1=1 \n");
		List list = new ArrayList();
		String value = map.get("JMXXID");//居民信息ID
		if(!StringUtils.isEmpty(value))
		{
			sql.append("and a.JMXXID=?");
			list.add(value);
		}
		value = map.get("ZJHM");
		if(!StringUtils.isEmpty(value)){
			sql.append(" and a.ZJHM = ? ");
			list.add(value);
		}

		SQLBean sqlBean = new SQLBean(sql.toString(),list.toArray());
		return super.queryOne(sqlBean);
	}

}
